<?php
class omeauto_condition_orderprice extends omeauto_auto{
    public $name = '订单金额';
    
    /*
     * 
     * 设置获取主html时的一些自定义smarty变量
     */
    function pagedata($data){
        $pagedata = array();
        
        if($data){
            $pagedata['price_from'] = $data['price_from'];
            $pagedata['price_to'] = $data['price_to'];
        }
        
        return $pagedata;
    }
    
    /*
     * 获取条件的详情
     */
    function condition_detail($data){
        return parent::condition_detail($data);
    }
    
    /*
     * 下拉详情
     */
    function detail_basic($data){
        $render = $this->get_render();
        
        $render->pagedata['price_from'] = $data['price_from'];
        $render->pagedata['price_to'] = $data['price_to'];
        
        return $render->fetch("condition/orderprice/detail_basic.html");
    }
    
    /*
     * 验证订单的sdf数据条件是否通过
     * 
     */
    function validate($order_sdf,$condition_data){
        $price = $order_sdf['total_amount'];
        $price_from = $condition_data['price_from']?$condition_data['price_from']:0;
        $price_to = $condition_data['price_to']?$condition_data['price_to']:9999999999;

        if(($price >= $price_from) && ($price <= $price_to)){
            return true;
        }else{
            return false;
        }
    }
    
    /*********************************************以下是非必须函数，多为过程函数*******************************************************/

}